package _543cloud_new;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;

public class Left_node extends Node{
	
	static int QUEUELENGTH = 10000;
	public ArrayList<Right_node> l_r = new ArrayList<Right_node>();	
	
	PriorityQueue<Right_node> neighbor_queue = new PriorityQueue<>(QUEUELENGTH, new rNodeCompare());
	
	public Left_node(String s, int n){
		super(s, n);
	}
	
	public void neighbor(Right_node rn){
		if(!neighbor_queue.contains(rn))
			neighbor_queue.add(rn);
	}
	
	public void neighbor_available(Right_node rn){
		if(!l_r.contains(rn))
			l_r.add(rn);
	}
	
	public class rNodeCompare implements Comparator<Right_node> {
		public int compare(Right_node x, Right_node y) {
			if (x.cap < y.cap)
				return 1;
			if (x.cap > y.cap)
				return -1;
			return 0;
		}
	}
	
	
}
